{extend name="base" /}
{block name="title"}保险录入{/block}
{block name="bread"}
<div class="bread-cram">
    <div class="bread-cram-inner">
        <span class="title">保险公司使用</span>
        <span class='sub-title'>- 保险录入</span>
    </div>
</div>
{/block}
{block name="main"}
          <div class="menu-content left">
            <div class="menu-content-title"><p>资料录入</p></div>
            <div class="step-box">
              <div class="active">保单险种</div>
              <div class="active">货品信息</div>
              <div class="active">货品受损</div>
              <div class="active">货品现状</div>
              <div>物权信息</div>
              <div>递交授权</div>
            </div>
            <div class="msg-tip" style="text-align: center">
              *以下资料作为法律责任依据请如实填写,<a>查看模板>></a>
            </div>
            <div class="form-box">
                <div class="form-content">
                        <div class="form-item">
                                <label>货品在：</label>
                                <input type="text" placeholder="请选择时间" id="present_at"/> 的现状
                              </div>
                              <div class="form-item uploader-box">
                                    <label>货品清单（限doc、xlsx、pdf）：</label>
                                    <div class="uploader">
                                            <ul id="uploader-files" class="uploader-files">
                                                <li class="uploader-file" style="background-image: url(&quot;http://temp.im/288x288/FF9500/000&quot;);"></li>
                                            </ul>
                                            <div class="uploader-content">
                                                <div class="uploader-input-box"><input type="file" accept="image/*" class="uploader-input"></div>
                                            </div>
                                        </div>
                                  </div>
                                <div class="form-item textarea">
                                <label class="vtt">货品现状描述：</label>
                                <textarea type="text" placeholder="请填写货品现状的详细信息，如：货品的品牌、型号、产地、生成如期" id="goods_desc"></textarea>
                              </div>
                              <div class="form-item uploader-box">
                                    <label>上传视频：</label>
                                    <div class="uploader">
                                            <!-- <ul id="uploader-files" class="uploader-files">
                                                <li class="uploader-file" style="background-image: url(&quot;http://temp.im/288x288/FF9500/000&quot;);"></li>
                                            </ul> -->
                                            <div class="uploader-content">
                                                <div class="uploader-input-box"><input type="file" accept="video/*" class="uploader-input"></div>
                                            </div>
                                        </div>
                                  </div>
                    <div class="form-item uploader-box">
                        <label>上传照片：</label>
                        <div class="uploader">
                            <!-- <ul id="uploader-files" class="uploader-files">
                                <li class="uploader-file" style="background-image: url(&quot;http://temp.im/288x288/FF9500/000&quot;);"></li>
                            </ul> -->
                            <div class="uploader-content">
                                <div class="uploader-input-box"><input type="file" accept="image/*" class="uploader-input"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-footer">
                        <div class="step-btn-box">
                          <div class="pre-btn" onclick="javascript:history.go(-1);">上一步</div>
                          <div class="next-btn">下一步</div>
                        </div>
                      </div>
            </div>
          </div>
<input type="hidden" value="{$policy_num}" name='policy_num'>
{/block}


{block name="js"}
<script type="text/javascript">
    $(function() {
        var laydate = layui.laydate;
        //常规用法
        laydate.render({
            elem: '#present_at'
        });
    $('.next-btn').on('click',function(){
        var poliecy = $("input[ name='policy_num']").val();
        var present_at = $("#present_at").val()
        var goods_desc = $("#goods_desc").val();
        $.ajax({
            type: 'POST',
            url: "{:url('insurer/addInsurer')}",
            data: {
                'policy_num': poliecy,
                'present_at': present_at,
                'goods_list': JSON.stringify( ['http://rongyp.oss-cn-shanghai.aliyuncs.com/12345你.doc','http://rongyp.oss-cn-shanghai.aliyuncs.com/12345你.doc'] ),//货品清单
                'goods_desc': goods_desc,
                'present_img':JSON.stringify(['shanghai.aliyuncs.com/tmp_e6e0448d60a5bfd06a028dd2c89e11e32781b3c24329784d.jpg','shanghai.aliyuncs.com/tmp_e6e0448d60a5bfd06a028dd2c89e11e32781b3c24329784d.jpg']  ),//货品现状
                'present_video':JSON.stringify(['shanghai.aliyuncs.com/tmp_e6e0448d60a5bfd06a028dd2c89e11e32781b3c24329784d.jpg','shanghai.aliyuncs.com/tmp_e6e0448d60a5bfd06a028dd2c89e11e32781b3c24329784d.jpg']  ),
                'now_status': 4
            },
            dataType: 'json',
            success: function (Json) {
                if (Json.code == 200) {
                    location.href = "{:url('insurer/step5')}?policy_num=" + Json.data.policy_num;
                } else {
                    layer.msg('保存失败', {icon: 2});
                }
            }
        });
    });
    });

</script>
{/block}